<?php foreach($worry_answer as $answer): ?>
<div class="Delistd bgno pb10">
        <div class="Delistdc" style="padding-top:10px;">
            <div class="Deugx">
                <a href="javascript:void(0);" answer_id="<?php echo $answer->getId(); ?>" answer_user_id="<?php echo $answer->getUserId(); ?>"><h1><?php echo $answer->getCommendationNum(); ?></h1></a>
                <a href="javascript:void(0);" answer_id="<?php echo $answer->getId(); ?>"><h2>举报</h2></a>
            </div>
            <div class="DeBcont">
                <div class="DeScont" style="padding-top:0px;">
                        <div class="Depto"><img src="<?php echo $answer->getAuthorCover(); ?>" width="38" height="38"></div>
                    <div class="DeScontc">
                        <div class="Deuntx"><strong style="color:#14929a;"><?php echo $answer->getAuthorName(); ?></strong> | <span><?php echo $answer->getAuthorCity(); ?>&nbsp;<?php echo $answer->getAuthorChildrenInfo(); ?></span></div>
                        <div class="DeSbor" style="width:547px;">
                               <?php echo $answer->getContent(); ?>
                        </div>
                    </div>
                </div>
                <?php foreach($answer->getAnswerReply() as $reply): ?>
                <?php if($reply->getUserId() != $answer->getUserId()): ?>
                    <div class="DeScont" style="width:648px;padding:20px 0px 0px 50px;">
                        <div class="DeScontc fl" style="width:549px;">
                            <div class="DeSbor" style="margin-top:0px;width:547px;">
                                    <?php echo $reply->getContent(); ?>
                            </div>
                        </div>
                        <div class="Depto fr"><img src="<?php echo $reply->getAuthorCover(); ?>" width="38" height="38"></div>
                    </div>
                <?php else: ?>
                    <div class="DeScont" style="padding-top:20px;">
                            <div class="Depto"><img src="<?php echo $reply->getAuthorCover(); ?>" width="38" height="38"></div>
                        <div class="DeScontc">
                            <div class="DeSbor" style="margin-top:0px; width:547px;">
                                    <?php echo $reply->getContent(); ?>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
                <?php endforeach; ?>
            </div>
        </div>
                    <?php if($sf_user->isAuthenticated()): ?>
                        <?php if($worry->getUserId() == $sf_user->getAttribute('user_id') || $answer->getUserId() == $sf_user->getAttribute('user_id') ): ?>
                        <div class="DeFlinksF">
                            <h1><a href="#">回复</a></h1>
                            <form action="<?php echo url_for('worry/create_reply'); ?>" method="post" class="HuiForm" onSubmit="return CheckForm_reply('reply_<?php echo $answer->getId() ; ?>');">
                                <textarea name="content" id="reply_<?php echo $answer->getId() ; ?>"></textarea>
                                <input type="hidden" name="worry_id" value="<?php echo $worry->getId(); ?>" />
                                <input type="hidden" name="answer_id" value="<?php echo $answer->getId(); ?>" />
                                <input type="submit" value="回复">
                            </form>
                        </div>
                        <?php else: ?>  
                            <div class="DeFlinks" style="height: 20px;"></div>
                        <?php endif; ?>
                    <?php else: ?>  
                            <div class="DeFlinks" style="height: 20px;"></div>
                    <?php endif; ?>
            </div>
<?php endforeach; ?>
<script type="text/javascript">

$(document).ready(function(){
    $(".Deugx > A > H1").click(function(){
        var answer_id = $(this).parent('A').attr('answer_id');
        var answer_user_id = $(this).parent('A').attr('answer_user_id');
        var h = $(this);
      
        $.post('<?php echo url_for('worry/commendation'); ?>',{'answer_id':answer_id,'answer_user_id':answer_user_id},function(data){
            var data = eval('('+data+')');
            
            if(data.error == 0){
                h.text(data.num);
            }
            alert(data.msg);
        });
    });
    
    $(".Deugx > A > H2").click(function(){
        var answer_id = $(this).parent('A').attr('answer_id');
        var h = $(this);
      
        $.post('<?php echo url_for('worry/report'); ?>',{'answer_id':answer_id},function(data){
            var data = eval('('+data+')');
            alert(data.msg);
        });
    });
});

function CheckForm_reply(reply_id){
        var content = jQuery.trim($('#'+reply_id).val());

        if(content.length<=0){
                layer.msg('写点什么吧！');
                return false;
        }

        return true;
}

</script>